Skip to content

Expand the thinnest chapters; fix figure style collisions; rework the selection guide - #3

Merged
dnakhoa merged 8 commits into
mainfrom
claude/course-improvements-pyoyiu
Nov 10, 2026
Merged

dnakhoa merged 8 commits into
mainfrom
claude/course-improvements-pyoyiu

Conversation

@dnakhoa

@dnakhoa dnakhoa commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Summary

New content (tested Python, new exercises, and a new diagram for every chapter except 17):

  • Ch 2 Memory: how malloc works.
    • Covers fragmentation, boundary-tag free lists, placement policies, size classes (dlmalloc, jemalloc, tcmalloc), the buddy system, slab allocation and arenas.
    • The simulations are checked by an invariant-testing harness.
    • Also explains the exact IEEE 754 arithmetic behind 0.1 + 0.2.
  • Ch 8 Balanced trees: AVL deletion, red-black deletion (double black), red-black trees as 2-3-4 trees (diagram), left-leaning red-black trees, and historical context.
  • Ch 17 Persistence: fat nodes and node copying, persistent vectors, persistent queues (banker's and real-time), finger trees, and Git and MVCC as persistence in practice.
  • Ch 25 Selection guide:
    • The selection matrix is rewritten, split by static versus dynamic data.
    • Adds a decision procedure with a flowchart and six worked selection problems.
    • Adds a list of common selection mistakes.
  • Ch 27 Distributed: Lamport, vector and hybrid logical clocks; sequence CRDTs (a tested RGA that converges under random delivery orders); Merkle anti-entropy.
  • Ch 28 Routing: longest-prefix match, multibit tries with controlled prefix expansion, DIR-24-8, DPDK's LPM table, and ECMP with Maglev hashing.

Fixes

  • Figure style collisions: inline SVG <style> rules are page-global, so figures on the same page restyled one another (Ch 8, Ch 16).
    • Every figure's classes are now prefixed with its file name.
    • check_book.py now fails on shared classes or ids, and CONTRIBUTING documents the rule.
  • Ch 25 selection matrix: several rows were muddled, for example a problem name listed as a structure, HyperLogLog and Count-Min sharing one row, and no Manacher's algorithm.
  • Ch 2: the floating-point formula omitted the exponent bias.
  • Ch 17: wrong date for confluent persistence, and the wrong unit for the fat-node space bound.
  • Ch 28: two wrong trie-size claims.
  • Ch 27: notes that the LWW register needs (time, replica id) to break ties.
  • Skip-list figure: a dot was covering a label.

Reference pages

  • Glossary: 21 new terms (127 in total).
  • Appendix A: a new section on allocators, logical clocks and routing lookups, plus new rows.
  • Volume V overview: now a study table.
  • README counts: updated (~220,000 words, 258 exercises).

Verification

  • python3 scripts/check_book.py passes.
  • mdbook build emits no warnings.
  • New and restyled figures were checked in light and dark themes.

Generated by Claude Code

…nd worked problems

The selection matrix had muddled rows: Fibonacci heap as the competitive
programming priority queue, HDT as the CP connectivity choice, HyperLogLog
and Count-Min sharing one row though they answer different questions, a
problem name ("Range Min Query") listed as a structure, and no Manacher's
algorithm for palindromes. It is now organised by static vs dynamic data
and covers 20 needs.

Adds a five-question decision procedure with a flowchart, six worked
selection problems (autocomplete with a tested sparse-table top-k, a
leaderboard, crawler URL dedup with a Bloom filter, rate limiting,
room bookings, fleet latency percentiles), a list of common selection
mistakes, and two exercises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ga8rBjM4kRZRhxKLznhSca
Adds a section on allocators as data structures: fragmentation, implicit
free lists with boundary tags, explicit and segregated free lists and
placement policies, size classes in dlmalloc/jemalloc/tcmalloc, the buddy
system (with a diagram) as used by the Linux page allocator, slab
allocation, and arenas. Runnable free-list, buddy and arena simulations
are checked by an invariant-testing harness. Also explains the exact
IEEE 754 arithmetic behind 0.1 + 0.2, fixes the float formula (the
exponent is biased), and adds three exercises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ga8rBjM4kRZRhxKLznhSca
…tory

Adds AVL deletion (ported the chapter's C code to tested Python with a
shared rebalance and delete), red-black deletion via the double black
with its four cases, a section showing red-black trees are 2-3-4 trees
(recolouring is a 4-node split, double black is underflow) with a
diagram, left-leaning red-black trees with tested insert and delete and
measured rotation counts, a historical context section, and three
exercises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ga8rBjM4kRZRhxKLznhSca
…rees

Adds fat nodes and node copying (with a tested fat-node BST and the
amortized argument for node copying) and how they compare with path
copying; a configurable-branching persistent vector; persistent queues,
showing why credit-based amortization fails under persistence and how
Okasaki's banker's queue and the real-time queue fix it; finger trees
and the monoid trick; and Git and PostgreSQL MVCC as persistence in
practice. Corrects the history (confluent persistence dates from 1994)
and the unit of the fat-node space bound. Three exercises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ga8rBjM4kRZRhxKLznhSca
Adds Lamport, vector and hybrid logical clocks (vector clocks build on
the chapter's VersionVector) with a worked three-process example and
space-time diagram; sequence CRDTs for collaborative editing, showing
why index-based edits diverge, the interleaving anomaly of fractional
positions, and a tested RGA that converges under random delivery
orders; and a short Merkle-tree anti-entropy section. Notes that the
LWW-Register needs (time, replica id) tie-breaking. Three exercises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ga8rBjM4kRZRhxKLznhSca
…other

Inline SVG <style> rules apply to the whole page. Chapter 8's three
figures each defined .n, .e, .t, .cap, .note and .k differently, and
Chapter 16's two figures disagreed on .note, so whichever style came last
won. Every figure's classes are now prefixed with its file name, and
check_book.py fails if two figures on the same page share a class or an
element id. Also moves the skip-list figure's end-of-search dot off the
47 label it was covering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ga8rBjM4kRZRhxKLznhSca
…glev

Adds a concrete longest-prefix-match section with a tested binary trie;
multibit tries with controlled prefix expansion, a stride-choice table
measured on a synthetic 50,000-route table, DIR-24-8 with a runnable
model, and DPDK's rte_lpm layout (with a diagram); and ECMP with Maglev
hashing, including a runnable table builder and measured balance and
disruption. Corrects two wrong size claims about binary and radix
tries. Three exercises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ga8rBjM4kRZRhxKLznhSca
… CONTRIBUTING

Adds 21 glossary terms (allocators, 2-3-4 and LLRB trees, persistence
techniques, logical clocks, sequence CRDTs, ECMP/Maglev, longest-prefix
match). Appendix A gains rows for persistent vectors, finger trees and
LLRB trees, notes on AVL vs red-black rotation counts, and a new section
on allocators, logical clocks and routing lookups. Volume V's overview
becomes a study table like Volumes I-III. CONTRIBUTING documents the
per-file CSS class prefix for figures. Counts updated (~220,000 words,
258 exercises).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ga8rBjM4kRZRhxKLznhSca
@dnakhoa
dnakhoa merged commit acc1d3e into main Nov 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants